<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.content {
			width: 200px;
			height: 200px;
			border: 1px solid #333;
			line-height: 200px;
			text-align: center;
		}

		input.active {
			background-color: red;
		}
	</style>
</head>

<body>
	<div id="app">
		<input
			v-for="(nav, index) in arr"
			type="button" 
			@click="tab(index)" 
			:class="{active: num===index}" 
			:value="nav.title">
		
		<div 
			v-for="(nav, index) in arr"
			class="content" 
			v-show="num === index">
			{{ nav.content }}
		</div>
	
	</div>
	<script src="./vue.js"></script>
	<script>
		const vm = new Vue({
			el: '#app',
			data: {
				arr: [
					{
						title: '标题1',
						content: '内容1'
					},
					{
						title: '标题2',
						content: '内容2'
					},
					{
						title: '标题3',
						content: '内容3'
					}
				],
				num: 0
			},
			methods: {
				tab (n) {
					this.num = n;
				}
			}
		})

	</script>
</body>

</html>